package com.example.dirviesystem.student.controller;

import com.example.dirviesystem.entity.TrainingVideo;
import com.example.dirviesystem.repository.TrainingVideoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/videos")
@CrossOrigin
public class TrainingVideoController {

    @Autowired
    private TrainingVideoRepository videoRepository;

    // 获取科二或科三的视频列表
    @GetMapping
    public List<TrainingVideo> getVideos(@RequestParam String subject) {
        return videoRepository.findBySubject(subject);
    }


}
